// vite.config.js
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue';
import path from 'path';

export default defineConfig({
  plugins: [vue()],
  resolve: {
    alias: {
      '@': path.resolve(__dirname, './src')
    }
  },
  build: {
    rollupOptions: {
      external: ['axios'],
      plugins: [
        {
          name: 'external-axios',
          resolveId(importee, importer) {
            if (importee === 'axios') {
              return importee;
            }
          },
          load(id) {
            if (id === 'axios') {
              return `export default window['axios'];`;
            }
          }
        }
      ]
    }
  }
});